import collections
import copy
class Solution(object):
    def recoverArray(self, nums):
        c = collections.Counter(nums)
        d = list(c.keys())
        d.sort()
        key_list = set(d)
        m = len(d)
        for i in range(1, m):
            if (d[i] - d[0]) % 2 == 0:
                k = (d[i] - d[0]) // 2
                new_c = copy.deepcopy(c)
                flag = True
                for key in d:
                    if new_c[key] > 0:
                        if key + 2 * k in key_list:
                            new_c[key + 2 * k] -= new_c[key]
                            new_c[key] = 0
                        else:
                            flag = False
                            break
                    else:
                        if new_c[key] < 0:
                            flag = False
                            break
                if flag:
                    break
        new_c = copy.deepcopy(c)
        ans = []
        for key in d:
            if new_c[key] > 0:
                new_c[key + 2 * k] -= new_c[key]
                ans += [key + k] * new_c[key]
        return ans
data = Solution()
nums = [2,10,6,4,8,12]
print(data.recoverArray(nums))